import type { Store } from './store';
import type { Member } from './member';

// 场地基本信息
export interface Venue {
  id: number;
  name: string;
}

// 订单状态
export enum OrderStatus {
  Pending = 1, // 待处理
  Confirmed = 2, // 已确认
  Completed = 3, // 已完成
  Cancelled = 4, // 已取消
  Rescheduled = 5, // 已改签
}

// 支付状态
export enum PaymentStatus {
  Unpaid = 1,
  Paid = 2,
  Refunded = 3,
}

// 订单信息
export interface Order {
  id: number;
  order_no: string;
  store_id: number;
  venue_id: number;
  member_id: number;
  total_amount: number;
  pay_amount: number;
  use_balance: boolean;
  balance_amount: number;
  status: OrderStatus;
  payment_status: PaymentStatus;
  start_time: number;
  end_time: number;
  remark: string;
  created_at: number;
  
  // 关联数据
  store?: Store;
  venue?: Venue;
  member?: Member;
}

// 订单列表查询参数
export interface OrderQuery {
  page?: number;
  pageSize?: number;
  keyword?: string; // 订单号或会员名
  store_id?: number;
  status?: OrderStatus;
  paymentStatus?: PaymentStatus;
  dateRange?: [string, string];
}

// 订单列表返回数据
export interface OrderListData {
  list: Order[];
  total: number;
  statistics: {
    total_orders: number;
    pending_orders: number;
    today_orders: number;
    total_amount: number;
  };
}